def combine(n,k):
    res=[]
    temp=[]
    def backtrack(n,k,startindex):
        if(len(temp)==k):
            res.append(temp[:])
            return
        for i in range(startindex,n+1):
            temp.append(i)
            backtrack(n,k,i+1)
            temp.pop()
    backtrack(n,k,1)
    return  res


res=combine(3,2)
print(res)